<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>iicps: xiicps_smbus_intr_master_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">iicps
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xiicps__smbus__intr__master__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xiicps_smbus_intr_master_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This example can run on zynqmp / versal platform evaluation board and IIC controller configured as master in interrupt-driven mode and Aardvark Analyzer used as slave. </p>
<p>It sends and receives the data using IIC master device for SMBus transfers.</p>
<pre> MODIFICATION HISTORY:</pre><pre>Ver   Who Date     Changes
</p>
<hr/>
<p>
1.00  gm  06/30/22 First release
3.18  gm  07/14/23 Added SDT support.</pre><pre></pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a7b6b38938c2a31f16140990e5ae4909a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiicps__smbus__intr__master__example_8c.html#a7b6b38938c2a31f16140990e5ae4909a">XIicPsSmbusMasterIntrExample</a> (u16 DeviceId)</td></tr>
<tr class="memdesc:a7b6b38938c2a31f16140990e5ae4909a"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function does a minimal test on the Iic device and driver as a design example.  <a href="#a7b6b38938c2a31f16140990e5ae4909a">More...</a><br/></td></tr>
<tr class="separator:a7b6b38938c2a31f16140990e5ae4909a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a41b1c933a934b05ba55a4e0f69c9fb01"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiicps__smbus__intr__master__example_8c.html#a41b1c933a934b05ba55a4e0f69c9fb01">XIicPsSmbusMasterWriteBlockData</a> (<a class="el" href="struct_x_iic_ps.html">XIicPs</a> *InstancePtr, u8 Command, u8 ByteCount, u8 *SendBufferPtr)</td></tr>
<tr class="memdesc:a41b1c933a934b05ba55a4e0f69c9fb01"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function writes a buffer of data to the smbus slave.  <a href="#a41b1c933a934b05ba55a4e0f69c9fb01">More...</a><br/></td></tr>
<tr class="separator:a41b1c933a934b05ba55a4e0f69c9fb01"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7133eab85731592fdb9d5d1c66bb6957"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiicps__smbus__intr__master__example_8c.html#a7133eab85731592fdb9d5d1c66bb6957">XIicPsSmbusMasterReadBlockData</a> (<a class="el" href="struct_x_iic_ps.html">XIicPs</a> *InstancePtr, u8 Command, u8 ByteCount, u8 *RecvBufferPtr)</td></tr>
<tr class="memdesc:a7133eab85731592fdb9d5d1c66bb6957"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function sends a command and reads a buffer of data from the smbus slave.  <a href="#a7133eab85731592fdb9d5d1c66bb6957">More...</a><br/></td></tr>
<tr class="separator:a7133eab85731592fdb9d5d1c66bb6957"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aec9a48698a06b521d36fbec8793119ec"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiicps__smbus__intr__master__example_8c.html#aec9a48698a06b521d36fbec8793119ec">Handler</a> (void *CallBackRef, u32 Event)</td></tr>
<tr class="memdesc:aec9a48698a06b521d36fbec8793119ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the handler which performs processing to handle data events from the IIC.  <a href="#aec9a48698a06b521d36fbec8793119ec">More...</a><br/></td></tr>
<tr class="separator:aec9a48698a06b521d36fbec8793119ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiicps__smbus__intr__master__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function to call the example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="aec9a48698a06b521d36fbec8793119ec"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Handler </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>CallBackRef</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Event</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the handler which performs processing to handle data events from the IIC. </p>
<p>It is called from an interrupt context such that the amount of processing performed should be minimized.</p>
<p>This handler provides an example of how to handle data for the IIC and is application specific.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CallBackRef</td><td>contains a callback reference from the driver, in this case it is the instance pointer for the IIC driver. </td></tr>
    <tr><td class="paramname">Event</td><td>contains the specific kind of event that has occurred.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function to call the example. </p>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, XST_FAILURE if unsuccessful.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xiicps__smbus__intr__master__example_8c.html#a7b6b38938c2a31f16140990e5ae4909a">XIicPsSmbusMasterIntrExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a7b6b38938c2a31f16140990e5ae4909a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XIicPsSmbusMasterIntrExample </td>
          <td>(</td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>DeviceId</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function does a minimal test on the Iic device and driver as a design example. </p>
<p>The purpose of this function is to illustrate how to use the <a class="el" href="struct_x_iic_ps.html" title="The XIicPs driver instance data. ">XIicPs</a> driver.</p>
<p>This function sends and receives data as a smbus master in interrupt driver mode of the IIC.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">DeviceId</td><td>is the Device ID of the IicPs Device and is the XPAR_&lt;IICPS_instance&gt;_DEVICE_ID value from xparameters.h</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>This function contains an infinite loop such that if interrupts are not working it may never return. </p>

<p>References <a class="el" href="struct_x_iic_ps___config.html#a2bdee49f560d4a22a433c6c327d6d912">XIicPs_Config::BaseAddress</a>, <a class="el" href="xiicps__intr__master__example_8c.html#aec9a48698a06b521d36fbec8793119ec">Handler()</a>, <a class="el" href="group__iicps__api.html#ga5b67ad96b8c40bdd47c2c2f8a57f170c">XIicPs_BusIsBusy()</a>, <a class="el" href="group__iicps__api.html#gae97ad9c202953c7e49bfb56533c47079">XIicPs_CfgInitialize()</a>, <a class="el" href="group__iicps__api.html#ga14c7ff4f51185d8aab0028c0eeb3c336">XIicPs_LookupConfig()</a>, <a class="el" href="group__iicps__api.html#gad64f0389aa694ecf21ca8a39e44cf13f">XIicPs_MasterInterruptHandler()</a>, <a class="el" href="group__iicps__api.html#ga6f9db7651cd6ee0232dc9fdaca3f976a">XIicPs_SelfTest()</a>, <a class="el" href="group__iicps__api.html#gafb24cfdacf6cf28d80126862dc1cfbe5">XIicPs_SetSClk()</a>, <a class="el" href="group__iicps__api.html#gab2581047e7d5607fe96fe0dac9673527">XIicPs_SetStatusHandler()</a>, <a class="el" href="xiicps__smbus__intr__master__example_8c.html#a7133eab85731592fdb9d5d1c66bb6957">XIicPsSmbusMasterReadBlockData()</a>, and <a class="el" href="xiicps__smbus__intr__master__example_8c.html#a41b1c933a934b05ba55a4e0f69c9fb01">XIicPsSmbusMasterWriteBlockData()</a>.</p>

<p>Referenced by <a class="el" href="xiicps__smbus__intr__master__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="a7133eab85731592fdb9d5d1c66bb6957"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XIicPsSmbusMasterReadBlockData </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_iic_ps.html">XIicPs</a> *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>ByteCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>RecvBufferPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function sends a command and reads a buffer of data from the smbus slave. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>contains the address of <a class="el" href="struct_x_iic_ps.html" title="The XIicPs driver instance data. ">XIicPs</a> instance. </td></tr>
    <tr><td class="paramname">Command</td><td>contains send command. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>contains the number of bytes to read. </td></tr>
    <tr><td class="paramname">RecvBufferPtr</td><td>contains the address of receive buffer.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="struct_x_iic_ps___config.html#a2bdee49f560d4a22a433c6c327d6d912">XIicPs_Config::BaseAddress</a>, <a class="el" href="struct_x_iic_ps.html#a0712c6574001a0661192db4d448daff5">XIicPs::Config</a>, <a class="el" href="xiicps__eeprom__intr__example_8c.html#aa443a47eeb2dc837aa355392c701f05e">TotalErrorCount</a>, <a class="el" href="group__iicps__api.html#ga5b67ad96b8c40bdd47c2c2f8a57f170c">XIicPs_BusIsBusy()</a>, <a class="el" href="group__iicps__api.html#ga87cbf2622a9c6ad66b18d4c3f9575a76">XIicPs_ClearOptions()</a>, <a class="el" href="group__iicps__api.html#ga90efda2a784d4b972f1835b0ba81cde1">XIicPs_DisableAllInterrupts</a>, <a class="el" href="group__iicps__api.html#ga9ec604e5ed330606d24a082484e905f0">XIICPS_ISR_OFFSET</a>, <a class="el" href="group__iicps__api.html#ga4817f45c28341cea4ab8960dc1203acb">XIicPs_MasterRecv()</a>, <a class="el" href="group__iicps__api.html#ga3027c1eb6ece3193a978a2da8e06c011">XIicPs_MasterSend()</a>, <a class="el" href="group__iicps__api.html#gabcc20fce80c1e8dff27be4e584c2cc27">XIicPs_ReadReg</a>, <a class="el" href="group__iicps__api.html#ga820f2cd7e2c7b77b9b5966e87eae2c09">XIICPS_REP_START_OPTION</a>, and <a class="el" href="group__iicps__api.html#gaec1dc5be2be8a7394263cfe56af976c5">XIicPs_SetOptions()</a>.</p>

<p>Referenced by <a class="el" href="xiicps__smbus__intr__master__example_8c.html#a7b6b38938c2a31f16140990e5ae4909a">XIicPsSmbusMasterIntrExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a41b1c933a934b05ba55a4e0f69c9fb01"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XIicPsSmbusMasterWriteBlockData </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_iic_ps.html">XIicPs</a> *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>ByteCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>SendBufferPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function writes a buffer of data to the smbus slave. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>contains the address of <a class="el" href="struct_x_iic_ps.html" title="The XIicPs driver instance data. ">XIicPs</a> instance. </td></tr>
    <tr><td class="paramname">Command</td><td>contains send command. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>contains the number of bytes to write. </td></tr>
    <tr><td class="paramname">SendBufferPtr</td><td>contains the address of send buffer.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="xiicps__eeprom__intr__example_8c.html#aa443a47eeb2dc837aa355392c701f05e">TotalErrorCount</a>, <a class="el" href="group__iicps__api.html#ga5b67ad96b8c40bdd47c2c2f8a57f170c">XIicPs_BusIsBusy()</a>, and <a class="el" href="group__iicps__api.html#ga3027c1eb6ece3193a978a2da8e06c011">XIicPs_MasterSend()</a>.</p>

<p>Referenced by <a class="el" href="xiicps__smbus__intr__master__example_8c.html#a7b6b38938c2a31f16140990e5ae4909a">XIicPsSmbusMasterIntrExample()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
